//
// Created by Castle-Moriarty on 2025/11/2.
//
#include <iostream>
using namespace std;

// return type deduction
auto process_number(int value) {
    if (value < 10) {
        return 22;
    }else {
        return 55;
    }
}

// Naked reference auto return type deduction
auto max(int& a,int& b) {
    if ( a > b) {
        return a;
    }else {
        return b; // will return a copy
    }
}



int main() {
    auto result = process_number(11);
    cout << result << endl;
    cout << "sizeof(result): " << sizeof(result) << endl;


    int a{4};
    int b{5};
    cout << endl;
    cout << "Naked reference auto return type deduction:" << endl;
    int maxValue = max(a,b); // a copy of the max is returned
    ++maxValue;

    cout << "a : " << a << endl;
    cout << "b : " << b << endl;
    cout << "maxValue : " << maxValue << endl;

    return 0;
}